package com.demo11.d17_03.multiThread.server;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
 * @Author: root
 * @Date: 2018/12/4 18:31
 */
public class MyServer {
    public static List<Socket> socketList = Collections.synchronizedList(new ArrayList<>());

    public static void main(String[] args) throws IOException {
        ServerSocket serverSocket = new ServerSocket(30000);
        while (true) {
            Socket socket = serverSocket.accept();
            socketList.add(socket);
            new Thread(new ServerThread(socket)).start();
        }
    }
}
